package com.niiwoo.activity.event.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Created by dengyunhui on 2018/03/21.
 */
@AllArgsConstructor
@Getter
public enum DeadlineUnitEnum {

    DAY(Byte.valueOf("2"), "天"),
    MONTH(Byte.valueOf("1"), "月");

    private Byte code;
    private String desc;

    public static DeadlineUnitEnum valueOf(Byte code) {
        for (DeadlineUnitEnum deadlineUnitEnum : DeadlineUnitEnum.values()) {
            if (code.byteValue() == deadlineUnitEnum.getCode()) {
                return deadlineUnitEnum;
            }
        }
        return null;
    }
}
